feat(core): M3a — modes + hooks framework + memory dual system#3
Merged
Conversation
Partial M3 (first of two PRs). Ships the policy/safety/memory primitives;
M3b (next PR) wires them into the agent loop and adds MCP + compaction +
statusLine + /init multi-phase + auto classifier mode.
What ships
----------
Core (packages/core/src/):
- modes/index.ts — 5 mode policies (default / acceptEdits / plan /
auto / dontAsk / bypassPermissions) → ModeVerdict
with the invariants from docs/design/sandbox-plan-
worktree.md §3.3 hardcoded:
· plan blocks all write tools, regardless of
permission
· acceptEdits permission-deny still wins
· dontAsk upgrades ask → deny (strict allowlist)
· bypass skips permissions (sandbox-only safety)
- hooks/types.ts — HookContext / HookHandlerOutput / HookResult
- hooks/dispatcher.ts — 9 events × command handler, sequential dispatch,
matcher tool-name with `|` OR separator, JSON
output parsing (last {...} in stdout), per-handler
timeout (default 60s), disableAllHooks override,
payload streamed to handler stdin as JSON
- memory/loader.ts — hierarchical DEEPCODE.md walk (cwd → parents),
user-level ~/.deepcode/DEEPCODE.md, AGENTS.md
auto-import at project root, .deepcode/rules/*.md
sorted load, @-import with 4-hop max + cycle
detection + maxBytes budget
Tests
-----
- modes/index.test.ts (14 tests, all 6 modes × 4 permission verdicts)
- hooks/dispatcher.test.ts (14 tests: exec, JSON parse, matcher, timeout,
stdin, disableAllHooks, unimplemented-type
graceful)
- memory/loader.test.ts (14 tests: empty / user / project / parents walk /
AGENTS.md / rules dir / @-import / unresolved /
cycle / maxBytes / maxDepth + walkUpwards unit)
Total: 197 passed / 4 skipped / 0 failed (was 151).
Deferred to M3b
---------------
- MCP client (stdio transport at minimum)
- Compaction (LLM summarizer when context > threshold)
- statusLine runner (JSON-on-stdin contract)
- /init multi-phase interactive flow
- auto classifier mode (LLM-judged per-call)
- 4 additional hook handler types (http / mcp_tool / prompt / agent)
- hooks `if` field (permission-syntax filtering)
- Wiring evaluateMode + HookDispatcher into runAgent (currently callable
but not yet enforcing in the agent loop)
Verified
--------
pnpm typecheck → green
pnpm build → green
pnpm test → 197 passed / 4 skipped / 0 failed
pnpm format:check → conformant
Docs
----
- docs/milestones/M3.md — delivery breakdown of M3a vs M3b deferred items
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 28, 2026
oratis
added a commit
that referenced
this pull request
May 30, 2026
…ession Implements the deferred inspector panel (design spec screen #3, HANDOFF §10). The right column is a 48px rail by default; the ‹ button or ⌘\ expands it to a 320px panel that squeezes the chat stream (via the .inspector-open grid modifier), not overlays it. Four sections: ▤ Plan — the agent's TodoWrite list + pending count ◐ Context — token usage bar (contextWindowFor(model) denominator) 📁 Recent files — files touched by Write/Edit/MultiEdit this conversation ⓘ Session info — project / path / model / mode / cumulative cost Empty sections show honest empty states (no fake placeholders). Wiring: ReplScreen lifts its inspector slice (usage/model/mode/recent files/ todos) to App via a single onInspector callback; App merges it into one InspectorData that feeds both the collapsed rail's badges and the expanded panel. The rail's ◐ context dot + ▤ plan badge are now driven by real data (previously hardcoded undefined). Taken over from the epic-neumann worktree and rebased onto main. Builds clean (vite 222 modules), typecheck + 24 desktop tests pass, format + 0 new lint warnings. NOTE: this is UI that still needs a visual pass in `pnpm --filter @deepcode/desktop tauri:dev` — confirm the 48↔320px toggle, ⌘\, and that all four sections render against the design spec. Logic/build are verified; pixels are not. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
oratis
added a commit
that referenced
this pull request
May 30, 2026
…ession (#91) Implements the deferred inspector panel (design spec screen #3, HANDOFF §10). The right column is a 48px rail by default; the ‹ button or ⌘\ expands it to a 320px panel that squeezes the chat stream (via the .inspector-open grid modifier), not overlays it. Four sections: ▤ Plan — the agent's TodoWrite list + pending count ◐ Context — token usage bar (contextWindowFor(model) denominator) 📁 Recent files — files touched by Write/Edit/MultiEdit this conversation ⓘ Session info — project / path / model / mode / cumulative cost Empty sections show honest empty states (no fake placeholders). Wiring: ReplScreen lifts its inspector slice (usage/model/mode/recent files/ todos) to App via a single onInspector callback; App merges it into one InspectorData that feeds both the collapsed rail's badges and the expanded panel. The rail's ◐ context dot + ▤ plan badge are now driven by real data (previously hardcoded undefined). Taken over from the epic-neumann worktree and rebased onto main. Builds clean (vite 222 modules), typecheck + 24 desktop tests pass, format + 0 new lint warnings. NOTE: this is UI that still needs a visual pass in `pnpm --filter @deepcode/desktop tauri:dev` — confirm the 48↔320px toggle, ⌘\, and that all four sections render against the design spec. Logic/build are verified; pixels are not. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
oratis
added a commit
that referenced
this pull request
Jun 1, 2026
…137) The collapsed inspector rail now matches design spec screen #3 exactly: ‹ expand · ▤ Plan (pending badge) · ◐ Context · 📁 Recent files · ⓘ Session info · ⚙ Settings. The four middle icons are inspector hints — clicking one expands the 320px panel and scrolls to that section (new `focusSection` prop on InspectorPanel + `data-section` anchors). The rail previously doubled as the *only* navigation to Permissions / MCP / Plugins / Skills / About. Per spec screen #9 those live behind the ⚙ cog in a shared Settings shell, so this adds <SettingsLayout> (a `.set-nav` left column + pane) and folds the settings-family screens into it — nothing is stranded. Sessions stay in the left sidebar where the spec puts them. - InspectorRail: trimmed to the 6 spec elements; onExpand(section) / onSettings / settingsActive replace the old screen-routing props. - SettingsLayout + SETTINGS_FAMILY: unified nav for settings-family screens. - App: expandInspector(section), settings-shell wrapping in renderScreen. - index.css: `.settings-shell` / `.set-nav` / `.set-pane` per spec lines 754-768; sticky `.inspector-head` so focused sections land below it. Verified in a browser harness: rail = 48px with exactly ‹/▤(badge)/◐/📁/ⓘ/⚙, panel = 320px, set-nav switches active screen, ⌘\ unchanged. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Test plan
Key invariants tested
From `docs/design/sandbox-plan-worktree.md` §3.3:
Documentation
Release notes label
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com